package flex.persistence.criteria {
	public interface AbstractQuery {
		
		/**
		 * distinct(distinct:Boolean):AbstractQuery 
		 * Specify whether duplicate query results will be eliminated.
		 */
		function distinct(distinct:Boolean):AbstractQuery;
		/**
		 * from(entityClass:Class):Root
		 * Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.
		 */
		function from(entityClass:Class):Root;

		/**
		 * getResultType():Class 
		 * Return the result type of the query or subquery.
		 */
		function get resultType():Class;
		
		/**
		 * get roots():Array
		 * Return the query roots.
		 */
		function get roots():Array;

		/**
		 * groupBy(grouping:Object):AbstractQuery
		 * Specify the expressions that are used to form groups over the query results.
		 */
		function groupBy(grouping:Object):AbstractQuery;
	
		/**
		 * having(restrictions:Predicate):AbstractQuery
		 * Specify a restriction over the groups of the query.
		 * having(restrictions:Array):AbstractQuery
		 * Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates.
		 */
		function having(restrictions:Object):AbstractQuery;
		
		/**
		 * isDisctinct():Boolean
		 * Return whether duplicate query results must be eliminated or retained.
		 */
		function isDisctinct():Boolean;
		
		/**
		 * subquery(type:Class):Subquery
		 * Create a subquery of the query.
		 */
		function subquery(type:Class):Subquery;
		
		/**
		 * where(restrictions:Predicate):AbstractQuery
		 * Modify the query to restrict the query results according to the specified boolean expression.
		 * where(restrictions:Array):AbstractQuery
		 * Modify the query to restrict the query results according to the conjunction of the specified restriction predicates.
		 */
		function where(restrictions:Object):AbstractQuery;
	}
}